package meta

import (
	"context"
	ui "github.com/gizak/termui/v3"
	apiv1 "gomod.alauda.cn/mysql-mgr-operator/api/v1"
)

type Presenter struct {
	Title         string
	metaChan      chan *apiv1.MySQLMeta
	ctx           context.Context
	cancel        context.CancelFunc
	isCancel      bool
	layout        *ui.Grid
	widgets       []ui.Drawable
	selectIndex   int
	currentMetaCr *apiv1.MySQLMeta
}

func NewMetaUi(ctx context.Context, title string, metaChan chan *apiv1.MySQLMeta) *Presenter {
	ctx, cancel := context.WithCancel(ctx)
	return &Presenter{
		Title:    title,
		metaChan: metaChan,
		ctx:      ctx,
		cancel:   cancel,
	}
}
